Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow dynamic updates to type mapping, update README #1319

Merged
merged 3 commits into from
Jul 10, 2019

Conversation

missinglink
Copy link
Member

@missinglink missinglink commented Jun 18, 2019

The original code was written with the notion that the 'type mapping' would be static, so in some cases, the setup() function was pre-processing the source/layer mapping in order to cache the values.

This would result in incorrect behaviour for sources/layers where the new values set by auto_discover were not being used.

This PR removes any pre-processing of the sources/layers and also uses a new function which ensures that existing pointer references are kept up-to-date.

@missinglink missinglink force-pushed the auto_discover_type_mapping branch from aec3a83 to 81dbb3c Compare June 18, 2019 17:37
@missinglink missinglink requested a review from orangejulius June 18, 2019 17:39
@missinglink missinglink force-pushed the auto_discover_type_mapping branch 4 times, most recently from 7b538c2 to d751225 Compare June 26, 2019 11:34
@missinglink missinglink changed the title update README allow dynamic updates to type mapping, update README Jun 26, 2019
@missinglink missinglink force-pushed the auto_discover_type_mapping branch from d751225 to 79875b3 Compare June 26, 2019 11:59
Copy link
Member

@orangejulius orangejulius left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good overall, nice solution to the dynamic update problem, and overall this cleans up the code a bit (looking at it now I really didn't like how just one property from the type_mapping object was passed to some sanitizers.

I have some thoughts on the readme wording but otherwise 👍

README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
README.md Show resolved Hide resolved
@@ -11,7 +11,7 @@ module.exports.middleware = (_api_pelias_config) => {
size: require('../sanitizer/_size')(/* use defaults*/),
layers: require('../sanitizer/_targets')('layers', type_mapping.layer_mapping),
sources: require('../sanitizer/_targets')('sources', type_mapping.source_mapping),
address_layer_filter: require('../sanitizer/_address_layer_filter')(type_mapping.layers_by_source),
address_layer_filter: require('../sanitizer/_address_layer_filter')(type_mapping),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice, this is way cleaner.

README.md Show resolved Hide resolved
@missinglink
Copy link
Member Author

Actioned PR feedback in 091b1ff

@missinglink missinglink merged commit 141ce75 into master Jul 10, 2019
@missinglink missinglink deleted the auto_discover_type_mapping branch July 10, 2019 11:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants